<%@ page language="java" import="com.tbrain.secretFriend.util.*,com.tbrain.secretFriend.service.*,com.tbrain.secretFriend.model.*,java.sql.*,java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Intercambio de Regalos 2007</title>
<link rel="stylesheet" href="./styles/styles.css" type="text/css"></link>
</head>
<body>
<%
	User user = (User)session.getAttribute("user");
	if(user==null){
		session.setAttribute("errorMessage",new Exception("Usuario sin session, necesitas volver a entrar"));
		request.getRequestDispatcher("./index.jsp").forward(request,response);
	}
	Connection conn = ConnectionHelper.getConnection();
	List wishes = new ArrayList();
	try{
		WishService wishService = new WishService(conn);
		wishes = wishService.selectWishList(user);
		//request.getRequestDispatcher("/secretFriend.jsp").forward(request,response);
	}catch(Exception e){
		session.setAttribute("errorMessage",e);
		request.getRequestDispatcher("./index.jsp").forward(request,response);
	}finally{
		if(conn!=null){
			conn.close();
		}
	}

%>
<form name="forma" action="updateWish.jsp">
	<%@ include file="header.jsp"%>
	<table width="800" cellpadding="0" cellspacing="0" border="0" align="center">
		<tr>
			<td colspan="4"><br></td>
		</tr>		
		<tr>
			<td width="100"></td>
			<td width="600" align="center" colspan="2"><h3 class="style2"><center><%=user.getUserName()%> Antes de decirte quien es tu amigo secreto escribe lo que te gustaria que te regalen, si no escribes nada, tu amigo secreto esogera un regalo especial para ti... </center></h3></td>
			<td width="100"></td>
		</tr>
		<tr>
			<td colspan="4"><br></td>
		</tr>
		<tr>
			<td colspan="4"><br></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="center" width="300"> <span class="style1">Opcion 1</span>: <br>
			<input name="wish1" type="text" size="30" class="style8"  maxlength="255" value="<%=wishes.size()>0?((Wish)wishes.get(0)).getDescription():""%>" > 
			</td>
			<td align="center" width="300"> <span class="style1">Pista de Donde Comprarlo o de como es</span>: 
			<textarea rows="4" cols="30" name="wishDetail1" class="style8"><%=wishes.size()>0?((Wish)wishes.get(0)).getComments():""%></textarea>
			</td>
			<td width="100"></td>
		</tr>
		<tr>
			<td colspan="4"><br></td>
		</tr>
		<tr>
			<td width="100"></td>
			<td align="center" width="300"> <span class="style1">Opcion 2</span>: <br>
			<input name="wish2" type="text" size="30" class="style8"  maxlength="255"  value="<%=wishes.size()>1?((Wish)wishes.get(1)).getDescription():""%>"> 
			</td>
			<td align="center" width="300"> <span class="style1">Pista de Donde Comprarlo o de como es</span>: 
			<textarea rows="4" cols="30" name="wishDetail2" class="style8"><%=wishes.size()>1?((Wish)wishes.get(1)).getComments():""%></textarea> 
			</td>
			<td width="100"></td>
		</tr>
		<tr>
			<td colspan="4"><br></td>
		</tr>
		<tr>
			<td width="100"></td> 
			<td align="center" width="300"> <span class="style1">Opcion 3</span>: <br>
			<input name="wish3" type="text" size="30" class="style8"  maxlength="255"  value="<%=wishes.size()>2?((Wish)wishes.get(2)).getDescription():""%>"> 
			</td>
			<td align="center" width="300"> <span class="style1">Pista de Donde Comprarlo o de como es</span>: 
			<textarea rows="4" cols="30" name="wishDetail3" class="style8"><%=wishes.size()>2?((Wish)wishes.get(2)).getComments():""%></textarea>
			</td>
			<td width="100"></td>
		</tr>
		<tr>
			<td colspan="4"><br></td>
		</tr>				
		<tr>
			<td colspan="4"><br></td>
		</tr>

		<tr>
			<td width="100"></td>
		  <td align="center" colspan="2" width="600"><span class="style2">Quieres averiguar quien es tu amigo secreto??? </span>&nbsp;&nbsp;<input type="submit" value="Si >>"></td>
			<td width="100"></td>
		</tr>		
	</table>
</form>
</body>
</html>
 